home *** CD-ROM | disk | FTP | other *** search
/ Gigarom 1 / Gigarom Macintosh Archives (Quantum Leap)(CDRM1080320)(1993).iso / FILES / DEV / A-B / 001. Sample.cpt / Sample.r < prev    next >
Text File  |  1988-08-01  |  6KB  |  232 lines

  1. /*------------------------------------------------------------------------------
  2. #
  3. #    Apple Macintosh Developer Technical Support
  4. #
  5. #    MultiFinder-Aware Simple Sample Application
  6. #
  7. #    Sample
  8. #
  9. #    Sample.r    -    Rez Source
  10. #
  11. #    Copyright © 1988 Apple Computer, Inc.
  12. #    All rights reserved.
  13. #
  14. #    Versions:    1.0                    8/88
  15. #
  16. #    Components:    Sample.p            August 1, 1988
  17. #                Sample.c            August 1, 1988
  18. #                Sample.r            August 1, 1988
  19. #                Sample.h            August 1, 1988
  20. #                PSample.make        August 1, 1988
  21. #                CSample.make        August 1, 1988
  22. #
  23. #    Sample is an example application that demonstrates how to
  24. #    initialize the commonly used toolbox managers, operate 
  25. #    successfully under MultiFinder, handle desk accessories, 
  26. #    and create, grow, and zoom windows.
  27. #
  28. #    It does not by any means demonstrate all the techniques 
  29. #    you need for a large application. In particular, Sample 
  30. #    does not cover exception handling, multiple windows/documents, 
  31. #    sophisticated memory management, printing, or undo. All of 
  32. #    these are vital parts of a normal full-sized application.
  33. #
  34. #    This application is an example of the form of a Macintosh 
  35. #    application; it is NOT a template. It is NOT intended to be 
  36. #    used as a foundation for the next world-class, best-selling, 
  37. #    600K application. A stick figure drawing of the human body may 
  38. #    be a good example of the form for a painting, but that does not 
  39. #    mean it should be used as the basis for the next Mona Lisa.
  40. #
  41. #    We recommend that you review this program or TESample before 
  42. #    beginning a new application.
  43. ------------------------------------------------------------------------------*/
  44.  
  45.  
  46. #include "Types.r"
  47.  
  48. #include "Sample.h"
  49.  
  50.  
  51. /* this is a definition for a resource which contains only a rectangle */
  52.  
  53. type 'RECT' {
  54.     rect;
  55. };
  56.  
  57.  
  58. /* we use an MBAR resource to conveniently load all the menus */
  59.  
  60. resource 'MBAR' (rMenuBar, preload) {
  61.     { mApple, mFile, mEdit, mLight };    /* four menus */
  62. };
  63.  
  64.  
  65. resource 'MENU' (mApple, preload) {
  66.     mApple, textMenuProc,
  67.     0b1111111111111111111111111111101,    /* disable dashed line, enable About and DAs */
  68.     enabled, apple,
  69.     {
  70.         "About Sample…",
  71.             noicon, nokey, nomark, plain;
  72.         "-",
  73.             noicon, nokey, nomark, plain
  74.     }
  75. };
  76.  
  77. resource 'MENU' (mFile, preload) {
  78.     mFile, textMenuProc,
  79.     0b0000000000000000000100000000000,    /* enable Quit only, program enables others */
  80.     enabled, "File",
  81.     {
  82.         "New",
  83.             noicon, "N", nomark, plain;
  84.         "Open",
  85.             noicon, "O", nomark, plain;
  86.         "-",
  87.             noicon, nokey, nomark, plain;
  88.         "Close",
  89.             noicon, "W", nomark, plain;
  90.         "Save",
  91.             noicon, "S", nomark, plain;
  92.         "Save As…",
  93.             noicon, nokey, nomark, plain;
  94.         "Revert",
  95.             noicon, nokey, nomark, plain;
  96.         "-",
  97.             noicon, nokey, nomark, plain;
  98.         "Page Setup…",
  99.             noicon, nokey, nomark, plain;
  100.         "Print…",
  101.             noicon, nokey, nomark, plain;
  102.         "-",
  103.             noicon, nokey, nomark, plain;
  104.         "Quit",
  105.             noicon, "Q", nomark, plain
  106.     }
  107. };
  108.  
  109. resource 'MENU' (mEdit, preload) {
  110.     mEdit, textMenuProc,
  111.     0b0000000000000000000000000000000,    /* disable everything, program does the enabling */
  112.     enabled, "Edit",
  113.      {
  114.         "Undo",
  115.             noicon, "Z", nomark, plain;
  116.         "-",
  117.             noicon, nokey, nomark, plain;
  118.         "Cut",
  119.             noicon, "X", nomark, plain;
  120.         "Copy",
  121.             noicon, "C", nomark, plain;
  122.         "Paste",
  123.             noicon, "V", nomark, plain;
  124.         "Clear",
  125.             noicon, nokey, nomark, plain
  126.     }
  127. };
  128.  
  129. resource 'MENU' (mLight, preload) {
  130.     mLight, textMenuProc,
  131.     0b0000000000000000000000000000000,    /* disable everything, program does the enabling */
  132.     enabled, "Traffic",
  133.      {
  134.         "Red Light",
  135.             noicon, nokey, nomark, plain;
  136.         "Green Light",
  137.             noicon, nokey, nomark, plain
  138.     }
  139. };
  140.  
  141.  
  142. /* this ALRT and DITL are used as an About screen */
  143.  
  144. resource 'ALRT' (rAboutAlert) {
  145.     {40, 20, 160, 292}, rAboutAlert, {
  146.         OK, visible, silent;
  147.         OK, visible, silent;
  148.         OK, visible, silent;
  149.         OK, visible, silent
  150.     };
  151. };
  152.  
  153. resource 'DITL' (rAboutAlert) {
  154.      {
  155.         {88, 180, 108, 260},
  156.         Button {
  157.             enabled,    "OK"
  158.         };
  159.         {8, 8, 24, 214},
  160.         StaticText {
  161.             disabled,    "Simple Sample (Traffic Light)"
  162.         };
  163.         {32, 8, 48, 237},
  164.         StaticText {
  165.             disabled,    "Copyright © 1988 Apple Computer"
  166.         };
  167.         {56, 8, 72, 136},
  168.         StaticText {
  169.             disabled,    "Brought to you by:"
  170.         };
  171.         {80, 24, 112, 167},
  172.         StaticText {
  173.             disabled,    "Macintosh Developer " $"CA" "Technical Support"
  174.         }
  175.     }
  176. };
  177.  
  178.  
  179. resource 'WIND' (rWindow, preload, purgeable) {
  180.     {60, 40, 290, 160},
  181.     noGrowDocProc, visible, noGoAway, 0x0, "Traffic"
  182. };
  183.  
  184. resource 'RECT' (rStopRect, preload, purgeable) {
  185.     {10, 10, 110, 110}
  186. };
  187.  
  188. resource 'RECT' (rGoRect, preload, purgeable) {
  189.     {120, 10, 220, 110}
  190. };
  191.  
  192.  
  193. /* we put the latest SIZE template here so we can rez with MPW 2.0 */
  194.  
  195. type 'SIZE' {
  196.         boolean        dontSaveScreen,
  197.                     saveScreen;
  198.         boolean     ignoreSuspendResumeEvents,
  199.                     acceptSuspendResumeEvents;
  200.         boolean        enableOptionSwitch,
  201.                     disableOptionSwitch;
  202.         boolean        cannotBackground,
  203.                     canBackground;
  204.         boolean        notMultiFinderAware,
  205.                     multiFinderAware;
  206.         boolean        notOnlyBackground,
  207.                     onlyBackground;
  208.         boolean        dontGetFrontClicks,
  209.                     getFrontClicks;
  210.         unsigned bitstring[9] = 0;
  211.         unsigned longint;    /* preferred memory size in bytes */
  212.         unsigned longint;    /* minimum memory size in bytes */
  213. };    /* ignore the warning caused by re-defining SIZE */
  214.  
  215.  
  216. /* here is the quintessential MultiFinder friendliness device, the SIZE resource */
  217.  
  218. resource 'SIZE' (-1) {
  219.     dontSaveScreen,
  220.     acceptSuspendResumeEvents,
  221.     enableOptionSwitch,
  222.     canBackground,        /* we can background; we don't currently, but our sleep value */
  223.                         /* guarantees we don't hog the Mac while we are in the background */
  224.     multiFinderAware,    /* this says we do our own activate/deactivate; don't fake us out */
  225.     notOnlyBackground,    /* this is definitely note a background-only application! */
  226.     dontGetFrontClicks,    /* change this is if you want "do first click" behavior like the Finder */
  227.     kPrefSize * 1024,    /* we made this (preferred) size bigger than the other (minimum) size */
  228.                         /* so you can have more text & scraps */
  229.     kMinSize * 1024        /* we looked at a heap dump while the program was running */
  230.                         /* it was using about 27K; we added 13K for stack, text & scraps */
  231. };
  232.